Created: 2022-07-10
Tags: #permanent
fseek(FILE *stream, long int offset, int whence)
Parameters of fseek() Explained
stream is the FILE pointeroffset starts)#include <stdio.h>
int main() {
// Open the file
FILE* fp = fopen("C:\\program.txt", "r");
// Move pointer to start of file
// And set offset as 5, basically ignore first 5 characters
fseek(fp, 5, SEEK_SET);
// Read from the file using fread()
char buffer[512];
fread(buffer, sizeof(buffer), sizeof(char), fp);
printf("File contains: \n%s", buffer);
fclose(fp);
}